package cn.ljy.uem.service.impl;

import cn.ljy.authority.service.impl.IBaseService;
import cn.ljy.common.exception.model.MyWebException;
import cn.ljy.uem.dao.ProjectDailyTypeMapper;
import cn.ljy.uem.dao.SchoolGradeMapper;
import cn.ljy.uem.model.ProjectDailyType;
import cn.ljy.uem.model.SchoolGrade;
import cn.ljy.uem.model.query.ProjectDailyTypeQuery;
import cn.ljy.uem.model.query.SchoolGradeQuery;
import cn.ljy.uem.service.ProjectDailyTypeService;
import cn.ljy.uem.service.SchoolGradeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;

/**
 * @description 工程日志类型
 * @author 王秋林
 * @date 2023-1-16 16:45
 */
@Service
@Slf4j
public class IProjectDailyTypeService extends IBaseService<ProjectDailyType, ProjectDailyTypeQuery> implements ProjectDailyTypeService {

    @Autowired
    private ProjectDailyTypeMapper mapper;

    @Override
    protected void beforeGet(Serializable id) {
    }

    @Override
    protected void beforeUpdate(ProjectDailyType projectDailyType) {

    }

    @Override
    protected void beforeSave(ProjectDailyType projectDailyType) {
        if(mapper.countByName(projectDailyType.getName())>0){
            throw new MyWebException("添加失败：该类型已经存在");
        }
    }

    @Override
    protected void beforeDelete(Serializable[] ids) {

    }
}
